package org.xyf.IM.common;


import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * 存放一些与当前实例有关的数据
 */
public class CacheData {

    private static final String TOPIC_NAME = "TOPIC_NAME";

    private static final Map<String, Object> dataMap = new ConcurrentHashMap<>();


    public static void put(String key,Object value) {
        dataMap.put(key, value);
    }

    public static  <T> T get(String key) {
        return (T) dataMap.get(key);
    }


    public static void cacheTopicName(String topicName) {
        dataMap.put(TOPIC_NAME,topicName);
    }

    public static String getTopicName() {
        return (String) dataMap.get(TOPIC_NAME);
    }

}
